package com.withoutwords.ui.drawing;


import com.withoutwords.R;

import android.app.Dialog;
import android.content.Context;
import android.view.View;
import android.widget.Button;
import android.widget.SeekBar;
import android.widget.SeekBar.OnSeekBarChangeListener;

public class EraserDialog extends Dialog implements OnSeekBarChangeListener, android.view.View.OnClickListener {

	public interface IEraserListener
	{
		public void clearAll();
		public void eraserWidthChanged(int eraserWidth);
		
	}
	private IEraserListener listener;
	int eraserSize;
	
	public EraserDialog(Context context,IEraserListener _listener) {
		super(context);
		 setContentView(R.layout.eraser_options);
		 listener = _listener;
		 SeekBar bar = (SeekBar)findViewById(R.id.sizeBar);
		 bar.setOnSeekBarChangeListener(this);
		 
		 Button btn = (Button)findViewById(R.id.btnClear);
		 btn.setOnClickListener(this);
	}

	@Override
	public void onProgressChanged(SeekBar seekBar, int progress,
			boolean fromUser) {
		listener.eraserWidthChanged(progress*2);
		
	}

	@Override
	public void onStartTrackingTouch(SeekBar seekBar) {
		// TODO Auto-generated method stub
		
	}

	@Override
	public void onStopTrackingTouch(SeekBar seekBar) {
		// TODO Auto-generated method stub
		
	}

	@Override
	public void onClick(View v) {
	listener.clearAll();
	dismiss();
		
	}

	
	
}
